#  Copyright (c) 2020 - ~, WANGXI
#  
#  OTCL PRACTICE TCL FILE
#  Used in NS-2 simulator
#  Clone from https://gitee.com/WangXi_Chn/ns2_modulelib
#  Note in https://www.yuque.com/wangxi_chn/kozrfl
#  
#  Change Logs:
#  Date           Author       Notes			Mail
#  2020-11-24     WangXi   	   first version	WangXi_Chn@foxmail.com

# Defien a class
Class People

# Init the odject
People instproc init {args} {

    # refer to the father class function with same name, actrually it's just a habit
    # it may be useless here,so this OTcl script does not achieve to shadow with C++ compile 
    eval $self next $args  
}

# Delet the odject
People instproc destroy {} {
    puts "Destroy People!"
    $self next 
}

# Method of config
People instproc config {sex age} {
    $self instvar sex_
    $self instvar age_
    set sex_ $sex 
    set age_ $age 
}

# Method of show
People instproc show {} {
    $self instvar sex_
    $self instvar age_
    puts " I'm a $sex_ and my age is $age_"
}

# example a obeject
People people_1

# Man and Woman herit from People
Class Man -superclass People
Class Woman -superclass People

set man_1 [new Man]
set woman_1 [new Woman]

$man_1 config man 20
$woman_1 config woman 30

$man_1 show

$man_1 destroy

#/************************ (C) COPYRIGHT 2020 WANGXI **************END OF FILE****/
